import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import { PROXY } from './src/configs/env'
import vue from '@vitejs/plugin-vue'
import ElementPlus from 'unplugin-element-plus/vite'
// https://vitejs.dev/config/
export default defineConfig({
  base: '',
  build: {
    outDir: 'ppt',
  },
  plugins: [vue(), ElementPlus({})],
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `
          @import '@/assets/styles/variable.scss';
          @import '@/assets/styles/mixin.scss';
        `,
      },
    },
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  server: {
    proxy: {
      '/prod-api': {
        target: PROXY,
        secure: false, // 接收无效证书的https
        changeOrigin: true,
      },
    },
  },
})
